Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
zkochan-drivelist
Advanced tools
List all connected drives in your computer, in all major operating systems
List all connected drives in your computer, in all major operating systems.
Notice that this module does not require admin privileges to get the drives in any supported operating system.
Supports:
The drivelist
core consists of a set of scripts built with technologies that
are available by default on the target operating systems (like Bash, VBScript,
etc). Each of these scripts attempts to get information about the available
drives (and metadata related to them), using any methods the target platform
provides, like a combination of diskutil
, /proc/mounts
, etc. You can find
these scripts in the scripts/
directory.
The scripts are then expected to print to stdout
all the drive information
they have gathered in a predefined way, based on the YAML language. The
scripts are expected to output a set of blocks (separated by blank lines), each
representing a drive with a set of key/value pairs. The exact keys that we
expect are constantly changing while we keep improving this module, but you can
see what the currently expected keys are by running the platform script that
corresponds to your operating system.
This is how the raw output looks on my MacBook Pro at the time of this writing:
$ ./scripts/darwin.sh
device: /dev/disk0
displayName: /dev/disk0
description: "APPLE SSD SM0256G"
size: 251000193024
mountpoints: []
raw: /dev/rdisk0
protected: False
system: True
device: /dev/disk1
displayName: /dev/disk1
description: "Macintosh HD"
size: 249779191808
mountpoints:
- path: /
raw: /dev/rdisk1
protected: False
system: True
Because of the simplicity of this module's design, supporting a new operating
system simply means adding a new script to scripts/
that gathers drive data
and outputs something similar to the above example. The challenge with this is
that we must ensure all the platform scripts print consistent output.
When the user executes drivelist.list()
, the module checks the operating
system of the client, and executes the corresponding drive scanning script as a
child process. It then parses the YAML output of the script as an array
of objects, and returns that to the user.
Examples (the output will vary depending on your machine):
const drivelist = require('drivelist');
drivelist.list((error, drives) => {
if (error) {
throw error;
}
console.log(drives);
});
Mac OS X:
[
{
device: '/dev/disk0',
displayName: '/dev/disk0',
description: 'GUID_partition_scheme',
size: 68719476736,
mountpoints: [
{
path: '/'
}
],
raw: '/dev/rdisk0',
protected: false,
system: true
},
{
device: '/dev/disk1',
displayName: '/dev/disk1',
description: 'Apple_HFS Macintosh HD',
size: 68719476736,
mountpoints: [],
raw: '/dev/rdisk0',
protected: false,
system: true
}
]
GNU/Linux
[
{
device: '/dev/sda',
displayName: '/dev/sda',
description: 'WDC WD10JPVX-75J',
size: 68719476736,
mountpoints: [
{
path: '/'
}
],
raw: '/dev/sda',
protected: false,
system: true
},
{
device: '/dev/sdb',
displayName: '/dev/sdb',
description: 'DataTraveler 2.0',
size: 7823458304,
mountpoints: [
{
path: '/media/UNTITLED'
}
],
raw: '/dev/sdb',
protected: true,
system: false
}
]
Windows
[
{
device: '\\\\.\\PHYSICALDRIVE0',
displayName: 'C:',
description: 'WDC WD10JPVX-75JC3T0',
size: 68719476736,
mountpoints: [
{
path: 'C:'
}
],
raw: '\\\\.\\PHYSICALDRIVE0',
protected: false,
system: true
},
{
device: '\\\\.\\PHYSICALDRIVE1',
displayName: 'D:, F:',
description: 'Generic STORAGE DEVICE USB Device',
size: 7823458304,
mountpoints: [
{
path: 'D:'
},
{
path: 'F:'
}
],
raw: '\\\\.\\PHYSICALDRIVE1',
protected: true,
system: false
},
{
device: '\\\\.\\PHYSICALDRIVE2',
displayName: '\\\\.\\PHYSICALDRIVE2',
description: 'Silicon-Power2G',
size: 2014314496,
mountpoints: [],
raw: '\\\\.\\PHYSICALDRIVE2',
protected: false,
system: false
}
]
Install drivelist
by running:
$ npm install --save drivelist
Kind: static method of drivelist
Summary: List available drives
Access: public
Param | Type | Description |
---|---|---|
callback | function | callback (error, drives) |
Example
const drivelist = require('drivelist');
drivelist.list((error, drives) => {
if (error) {
throw error;
}
drives.forEach((drive) => {
console.log(drive);
});
});
Run the test suite by doing:
$ npm test
We're looking forward to support more operating systems. Please raise an issue or even better, send a PR to increase support!
Before submitting a PR, please make sure that you include tests, and that the linter runs without any warning:
$ npm run lint
Execute the following command after making any changes to the platform scripts:
npm run compile-scripts
If you're having any problem, please raise an issue on GitHub.
The project is licensed under the Apache 2.0 license.
FAQs
List all connected drives in your computer, in all major operating systems
The npm package zkochan-drivelist receives a total of 1 weekly downloads. As such, zkochan-drivelist popularity was classified as not popular.
We found that zkochan-drivelist demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.